local skel = fk.CreateSkill {
  name = "rmt__kuihuacixue",
}

skel:addEffect(fk.CardUseFinished, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if player ~= target or not player:hasSkill(skel.name) then return false end
    local cid = data.card:getEffectiveId()
    if cid and player.room:getCardArea(cid) == Card.Processing then
      local tos = data.tos
      if #tos == 1 then
        local to = tos[1]
        if not to.dead and #to:getAvailableEquipSlots() > 0 then
          return true
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local to = (data.tos)[1]
    if player.room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#rmt__kuihuacixue-invoke:"..to.id}) then
      event:setCostData(self, {tos = {to}})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = data.tos[1]
    local cids = room:getSubcardsByRule(data.card, {Card.Processing})
    to:addToPile("rmt__sunflowerneedle", cids, true, skel.name)
    local slots = to:getAvailableEquipSlots()
    if #slots > 0 then
      local slot = room:askToChoice(player, {choices = slots, skill_name = skel.name, prompt = "#rmt__kuihuacixue-slot"})
      room:abortPlayerArea(to, slot)
    end
    if not player.dead then
      player:drawCards(1, skel.name)
    end
  end,
})

Fk:loadTranslationTable{
  ["rmt__kuihuacixue"] = "葵花刺穴",
  [":rmt__kuihuacixue"] = "你使用基本牌或普通锦囊牌结算后，你可以将之置于唯一目标的武将牌上，然后废除其一个装备栏并摸一张牌。",
  ["#rmt__kuihuacixue-invoke"] = "葵花刺穴：你可以将此牌置于 %src 脸上，废除其一个装备栏并摸一张牌。",
  ["#rmt__kuihuacixue-slot"] = "葵花刺穴：选择要废除的装备栏",
  ["rmt__sunflowerneedle"] = "针",

  ["$rmt__kuihuacixue1"] = "人间有情尽白发，天地无意了沧桑",
  ["$rmt__kuihuacixue2"] = "天予大任，赐我神功，日出东方，唯我不败！",
}

return skel
